-
Notifications
You must be signed in to change notification settings - Fork 14.1k
skip proving the trait goal if possible in NormalizesTo goal
#149533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
also split the `assembly_and_merge_candidates` for `HostEffect` and `NormalizesTo`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure whether candidate preference matters to effect goal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's whatever :> please add a FIXME(const_traits) to assemble_and_merge_candidates that this was copied from the old projection normalization behavior and might not be what we actually want here
| // | ||
| // We currently intentionally do not guide inference this way. | ||
| // Since we skip proving the trait goal in normalizes-to goal now, the normalizes-to | ||
| // goal can successfully resolve the infer var via param env. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unavoidable since we don't know whether the trait goal will succeed or not at this time.
|
The job Click to see the possible cause of the failure (guessed by this bot) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fun, this isn't quite the behavior of the old trait solver either :3
the old solver only skips trying to prove the trait goal of we've got a builtin trait object impls. I think this ended up not really being necessary after your previous work?
idk... this sucks xd
let's see if the change impacts perf in a major way. If so, we can still avoid assembling impls in some cases at least :3
| D: SolverDelegate<Interner = I>, | ||
| I: Interner, | ||
| { | ||
| pub(super) fn normalize_trait_associated_term( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| pub(super) fn normalize_trait_associated_term( | |
| pub(super) fn normalize_projection_term( |
that's what we use in AliasTermKind 🤔
| // We currently intentionally do not guide inference this way. | ||
| // Since we skip proving the trait goal in normalizes-to goal now, the normalizes-to | ||
| // goal can successfully resolve the infer var via param env. | ||
| // This causes the stalled ambiguous trait goal to succeed as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this also doesn't compile with the old solver right now 🤔 why?
ah, because the old solver always uses assemble_candidates_from_impls and forces ambiguity unless assembly resulted in a builtin trait object candidate :<
that's wild xx
| // We don't care about overflow. If proving the trait goal overflowed, then | ||
| // it's enough to report an overflow error for that, we don't also have to | ||
| // overflow during normalization. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // We don't care about overflow. If proving the trait goal overflowed, then | |
| // it's enough to report an overflow error for that, we don't also have to | |
| // overflow during normalization. | |
| // We don't care about overflow. If proving the trait goal overflowed, then | |
| // it's enough to report an overflow error for that, we don't also have to | |
| // overflow for the const bound. |
or sth
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's whatever :> please add a FIXME(const_traits) to assemble_and_merge_candidates that this was copied from the old projection normalization behavior and might not be what we actually want here
| // If we're normalizing an GAT, we bail if using a where-bound would constrain | ||
| // its generic arguments. | ||
| // FIXME(generic_associated_types): Addresses aggressive inference in #92917. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flip these two statements. I want the comment to start with the FIXME. Right now it seems like the first line is separate from the content of the FIXME
| &mut self, | ||
| goal: Goal<I, ty::NormalizesTo<I>>, | ||
| ) -> QueryResult<I> { | ||
| let (mut candidates, _) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment: something something we already looked for param_env and alias-bound candidates so we don't have to assemble them again
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
skip proving the trait goal if possible in `NormalizesTo` goal
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (405e127): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary 0.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -21.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 469.029s -> 471.041s (0.43%) |
And also split
assembly_and_merge_candidatesforHostEffectandNormalizesTogoals.r? @lcnr